<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>套餐管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "../../include/layui.ftl" />
    <#include "../../include/pTable.ftl" />
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form  id="queryForm">
                <input type="hidden" id="className" name="className" value="${className!}" />
                <input type="hidden" id="modleName" name="modleName" value="${modleName!}" />
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">套餐名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="name_searchType" value="like">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-card-body">
            <table id="lay-table" lay-filter="lay-table"></table>
            <script type="text/html" id="toolbar"></script>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '${path}/plug-in/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','tables','layers'],function () {
        var tables = layui.tables,
                table = layui.table,
                layers = layui.layers,
                $ = layui.$;
        var parmer = {
            url:'/console/com.fs.common.pojo.Product/list',
            defaultToolbar: ['filter'],
            where:{sort : 'create_time',order:'desc'},
            cols: [[
                {field:"name",width:150,title:"套餐名称" },
                {field:"type",width:150,title:"类型" ,templet:function(d){
                    if ( d.type == "basic") return "基础检测套餐";
                    if ( d.type == "web") return "网页套餐";
                    if ( d.type == "one") return "首年会员套餐";
                    if ( d.type == "two") return "第二年续费套餐";
                    if ( d.type == "three") return "第三年续费套餐";
                }},
                {field:"introduce",width:200,title:"介绍" },
                {field:"price",width:150,title:"设定价格（分）" },
                {field:"exceedPrice",width:150,title:"超出价格（分）" },
                {field:"count",width:150,title:"次数" },
                {field:"defaultChoice",width:100,title:"默认选择",templet:function(d){
                        return d.defaultChoice == true? "是" : "否";
                }},
                {field:"startDate",width:150,title:"开始时间" },
                {field:"endDate",width:150,title:"结束时间" },
                {field:"remark",width:250,title:"备注" }
            ]]
        };
        var $tables = tables.renderTable(parmer);

    //头工具栏事件
    table.on('toolbar(lay-table)', function(obj){
        switch(obj.event){
            case '01':
                layers.add({
                    area:['700px', '600px']
                });
                break;
            case '02':
                layers.edit({
                    area:['700px', '500px'],
                    data: p.data
                });
                break;
            case '03':
                if (p.data != undefined && p.data.type == "basic") {
                    layer.msg("基础检测套餐不允许删除！");
                    break;
                }
                layers.delete({data:p.data});
                break;
            case '05':
                var where = $("#queryForm").serializeObject();
                $tables.reload({
                    where: where,
                    text: {none: '暂无数据！'}
                });
                break;

        };
    });
    });
</script>
</body>
</html>